<?php
/**
 * ImagePolicyViolation
 *
 * PHP version 5
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */

/**
 * Sponsored Brands campaign management
 *
 * Create and manage Sponsored Brands campaigns.   To learn more about Sponsored Brands campaigns, see:   - [Sponsored Brands overview](guides/sponsored-brands/overview)  - [Sponsored Brands campaign structure](guides/sponsored-brands/campaigns/structure)  - [Get started with Sponsored Brands campaigns](guides/sponsored-brands/campaigns/get-started-with-campaigns)
 *
 * OpenAPI spec version: 4.0
 * 
 * Generated by:https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api.git
 * AmazonAdvertisingApi Codegen version: 3.0.51
 */
/**
 * NOTE: This class is auto generated by the AmazonAdvertisingApi code generator program.
 *https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 * Do not edit the class manually.
 */

namespace AmazonAdvertisingApi\Model;

use \ArrayAccess;
use \AmazonAdvertisingApi\ObjectSerializer;

/**
 * ImagePolicyViolation Class Doc Comment
 *
 * @category Class
 * @description Structure of policy violation for a image component
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */
class ImagePolicyViolation implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $AmazonAdvertisingApiModelName = 'ImagePolicyViolation';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiTypes = [
        'policy_description' => 'string',
        'image_evidences' => '\AmazonAdvertisingApi\Model\ImageEvidence[]',
        'name' => 'string',
        'type' => 'string',
        'policy_link_url' => 'string',
        'text_evidences' => '\AmazonAdvertisingApi\Model\TextEvidence[]'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiFormats = [
        'policy_description' => null,
        'image_evidences' => null,
        'name' => null,
        'type' => null,
        'policy_link_url' => null,
        'text_evidences' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiTypes()
    {
        return self::$AmazonAdvertisingApiTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiFormats()
    {
        return self::$AmazonAdvertisingApiFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'policy_description' => 'policyDescription',
        'image_evidences' => 'imageEvidences',
        'name' => 'name',
        'type' => 'type',
        'policy_link_url' => 'policyLinkUrl',
        'text_evidences' => 'textEvidences'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'policy_description' => 'setPolicyDescription',
        'image_evidences' => 'setImageEvidences',
        'name' => 'setName',
        'type' => 'setType',
        'policy_link_url' => 'setPolicyLinkUrl',
        'text_evidences' => 'setTextEvidences'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'policy_description' => 'getPolicyDescription',
        'image_evidences' => 'getImageEvidences',
        'name' => 'getName',
        'type' => 'getType',
        'policy_link_url' => 'getPolicyLinkUrl',
        'text_evidences' => 'getTextEvidences'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$AmazonAdvertisingApiModelName;
    }

    const TYPE_WARNING = 'WARNING';
    const TYPE_REJECTED = 'REJECTED';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getTypeAllowableValues()
    {
        return [
            self::TYPE_WARNING,
            self::TYPE_REJECTED,
        ];
    }

    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['policy_description'] = isset($data['policy_description']) ? $data['policy_description'] : null;
        $this->container['image_evidences'] = isset($data['image_evidences']) ? $data['image_evidences'] : null;
        $this->container['name'] = isset($data['name']) ? $data['name'] : null;
        $this->container['type'] = isset($data['type']) ? $data['type'] : null;
        $this->container['policy_link_url'] = isset($data['policy_link_url']) ? $data['policy_link_url'] : null;
        $this->container['text_evidences'] = isset($data['text_evidences']) ? $data['text_evidences'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        $allowedValues = $this->getTypeAllowableValues();
        if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'type', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets policy_description
     *
     * @return string
     */
    public function getPolicyDescription()
    {
        return $this->container['policy_description'];
    }

    /**
     * Sets policy_description
     *
     * @param string $policy_description A human-readable description of the policy.
     *
     * @return $this
     */
    public function setPolicyDescription($policy_description)
    {
        $this->container['policy_description'] = $policy_description;

        return $this;
    }

    /**
     * Gets image_evidences
     *
     * @return \AmazonAdvertisingApi\Model\ImageEvidence[]
     */
    public function getImageEvidences()
    {
        return $this->container['image_evidences'];
    }

    /**
     * Sets image_evidences
     *
     * @param \AmazonAdvertisingApi\Model\ImageEvidence[] $image_evidences List of evidences for the policy violations detected on the image component.
     *
     * @return $this
     */
    public function setImageEvidences($image_evidences)
    {
        $this->container['image_evidences'] = $image_evidences;

        return $this;
    }

    /**
     * Gets name
     *
     * @return string
     */
    public function getName()
    {
        return $this->container['name'];
    }

    /**
     * Sets name
     *
     * @param string $name A policy violation code.
     *
     * @return $this
     */
    public function setName($name)
    {
        $this->container['name'] = $name;

        return $this;
    }

    /**
     * Gets type
     *
     * @return string
     */
    public function getType()
    {
        return $this->container['type'];
    }

    /**
     * Sets type
     *
     * @param string $type Type of policy violation.
     *
     * @return $this
     */
    public function setType($type)
    {
        $allowedValues = $this->getTypeAllowableValues();
        if (!is_null($type) && !in_array($type, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'type', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['type'] = $type;

        return $this;
    }

    /**
     * Gets policy_link_url
     *
     * @return string
     */
    public function getPolicyLinkUrl()
    {
        return $this->container['policy_link_url'];
    }

    /**
     * Sets policy_link_url
     *
     * @param string $policy_link_url Address of the policy documentation. Follow the link to learn more about the specified policy.
     *
     * @return $this
     */
    public function setPolicyLinkUrl($policy_link_url)
    {
        $this->container['policy_link_url'] = $policy_link_url;

        return $this;
    }

    /**
     * Gets text_evidences
     *
     * @return \AmazonAdvertisingApi\Model\TextEvidence[]
     */
    public function getTextEvidences()
    {
        return $this->container['text_evidences'];
    }

    /**
     * Sets text_evidences
     *
     * @param \AmazonAdvertisingApi\Model\TextEvidence[] $text_evidences Policy violation on an image can be detected on the ocr detected text on the image as well. This list of text evidences will have the policy violations detected on the text on top of the image.
     *
     * @return $this
     */
    public function setTextEvidences($text_evidences)
    {
        $this->container['text_evidences'] = $text_evidences;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
